package com.example.mapper;

import com.example.pojo.Dept;
import com.example.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    @Select("select * from departments")
    List<Dept> selectAll();

    @Insert("insert into departments (departmentName,parentDepartmentID) values (#{departmentName},#{parentDepartmentID})")
    void add(Dept dept);

    @Delete("delete from departments where departmentID = #{id}")
    void delete(Integer id);

    @Update("update departments set departmentName=#{departmentName},parentDepartmentID=#{parentDepartmentID} where departmentID=#{departmentID}")
    void update(Dept dept);

    @Select("select * from employees where departmentID = #{id}")
    List<Emp> selectEmp(Integer id);
}
